<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bai 2.10</title>
</head>

<body>
<?php
	if(isset($_POST['a'])&&isset($_POST['b']))
	{
		$a=$_POST['a'];
		$b=$_POST['b'];
		$nghiem=$a==0?($b==0?"Phương trình có vô số nghiệm":"Phương trình vô nghiệm"):"x = ".(-$b/$a);
	}
?>
<form id="form1" name="form1" method="post" action="Bai2_10.php">
  <table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr style="text-align: center">
      <td colspan="2" bgcolor="#996600" style="color:#FC0">GIẢI PHƯƠNG TRÌNH BẬC NHẤT</td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td nowrap="nowrap">Phương trình:</td>
      <td nowrap="nowrap"><input name="a" type="text" id="a" value="<?php echo $_POST['a'];?>" size="5" maxlength="10" />
        x + 
        <input name="b" type="text" id="b" value="<?php echo $_POST['b'];?>" size="5" maxlength="10" /> 
        = 0</td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td nowrap="nowrap">Nghiệm:</td>
      <td nowrap="nowrap"><input name="nghiem" type="text" id="nghiem" style="background-color:#0F9" value="<?php echo $nghiem;?>" size="50" readonly="readonly" /></td>
    </tr>
    <tr bgcolor="#FFFFCC" style="text-align: center">
      <td colspan="2"><input type="submit" name="submit" id="submit" value="Giải phương trình" /></td>
    </tr>
  </table>
</form>
</body>
</html>